package com.xishu.dao.jpa;

import com.xishu.entity.shop.CatalogItemMapping;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface CatalogItemMappingDao extends JpaRepository<CatalogItemMapping, Long>, JpaSpecificationExecutor<CatalogItemMapping> {

    @Modifying
    @Transactional
    @Query("update  catalog_item_mapping set saleOut = null  where shopId=:shopId  ")
    public void cleanSalOut(long shopId);

    /**
     * in查询
     *
     * @param catalogIdList
     * @return
     */
    List<CatalogItemMapping> findByCatalogIdIn(List<Long> catalogIdList);
}
